<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // function getMax(x = 0, n = 0) {
    //   let max = 0
    //   if (x > n) {
    //     max = x
    //   } else {
    //     max = n
    //   }
    //   return max
    // }
    // let max = getMax(58, 56)
    // console.log(max);


    function getSum(arr = []) {
      let max = 0
      let min = arr[0]
      for (let i = 0; i < arr.length; i++) {
        if (max < arr[i]) {
          max = arr[i]
        }
        if (min > arr[i]) {
          min = arr[i]
        }
      }
      return { min, max }
    }
    let re = getSum([1, 75, 46, 12, 98])
    console.log(re);
  </script>
</body>

</html>